﻿using UnityEngine;
using UnityEditor;
public class UnityEditorGizmos : MonoBehaviour
{
    public float areaRadus;
    public float size;
    public Vector3 vecto = Vector3.one;
    public Vector3[] piontArray;
    public float filed;
    public float minValue;
    public float maxValue;
    public float width;

    public Texture texture;

    public Vector3 origin, direction;
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    private void OnDrawGizmos()
    {
        //每一帧都调用 Scene场景起作用
        //Debug.Log("OnDrawGizmos");
    }

    private void OnDrawGizmosSelected()
    {

        Gizmos.color = Color.green;

        //选中该suffe时 开启每帧调用
        //Debug.Log("you click on me");
        //绘制线框球
        //Gizmos.DrawWireSphere(transform.position, areaRadus);

        //绘制sphere
        //for (int i = 0; i < piontArray.Length; i++)
        //{
        //    Gizmos.DrawSphere(piontArray[i], size);
        //}
        //Gizmos.color = Color.red;
        //for (int i = 0; i < piontArray.Length; i++)
        //{
        //    Gizmos.DrawLine(piontArray[i], piontArray[(int)Mathf.Repeat(i + 1, piontArray.Length)]);

        //}

        Gizmos.color = Color.green;
        //绘制Line
        //Gizmos.DrawLine(transform.position, transform.position + transform.forward * size);

        //绘制cube
        //Gizmos.DrawCube(transform.position, vecto);

        //绘制视图 摄像机
        //Gizmos.DrawFrustum(transform.position, filed, maxValue, minValue, width);

        //绘制图片
        //Gizmos.DrawGUITexture(new Rect(0.5f, 0.5f, 1.0f, 1.0f), texture);

        Gizmos.DrawIcon(transform.position + transform.up * size, "blue.png");

        //Gizmos.DrawRay(new Ray(origin,direction));

    }
}
